<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="application/rdf+xml; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  

<%@page import="net.groupme.api.ontology.GroupMeOntology"%>
<%@page import="net.groupme.api.ontology.FOAFOntology"%>
<%@page import="net.groupme.api.ontology.TagOntology"%>
<%@page import="net.groupme.search.SearchManager"%>
<%@page import="net.groupme.search.strategy.TagSearchStrategyAmount"%>
<%@page import="java.util.List"%>
<%@page import="net.groupme.search.strategy.model.WeightedTag"%>
<%@page import="net.groupme.gui.constants.VIEW_VOCABULARY"%>
<%@page import="net.groupme.model.ObjectFactory"%>
<%@page import="net.groupme.model.User"%>
<rdf:RDF
    xmlns="<%= GroupMeOntology.NS %>"
    xmlns:foaf="<%= FOAFOntology.NS %>"
    xmlns:scot="http://scot-project.org/scot/ns#"
    xmlns:dct="http://purl.org/dc/terms/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:tags="<%= TagOntology.NS %>"
  xml:base="<%= GroupMeOntology.BASE %>">

  <foaf:<%= FOAFOntology.PERSON %> rdf:about="<c:out value='${user.URI}'/>">
  	  <!-- Name, description, and alternative ULR of the resource -->
      <foaf:<%= FOAFOntology.NAME %>><c:out value='${user.firstName}'/> <c:out value='${user.lastName}'/></foaf:<%= FOAFOntology.NAME %>>
		<c:if test="${user.photo != null}">
		  <foaf:img rdf:resource="<c:out value='${user.photo}'/>"/>
		</c:if>
		<c:if test="${user.foaf != null}">
			<rdfs:seeAlso rdf:resource="<c:out value="${user.foaf}"/>"/>
		</c:if>
		<c:forEach items="${user.groups}" var="group" varStatus="status">
			<foaf:<%= FOAFOntology.MADE %>> 
				<<%= GroupMeOntology.GROUP %> rdf:about="<c:out value="${group.URI}"/>">
					<dc:title><c:out value="${group.name}" /></dc:title>
					<dc:description><c:out value="${group.description}" /></dc:description>
				</<%= GroupMeOntology.GROUP %>>
			</foaf:<%= FOAFOntology.MADE %>>
		</c:forEach>
  </foaf:<%= FOAFOntology.PERSON %>>
  <%
	 String username = request.getAttribute(VIEW_VOCABULARY.PARAMETER_USERNAME) + "";
	 if(username != null){
		User theUser = ObjectFactory.getUser(username);
		if(theUser != null){
		 	List<WeightedTag> userTagCloud = new TagSearchStrategyAmount().getTagCloud(null, null, theUser, 20);%>
		 	<scot:TagCloud>
 			<!-- The user's GroupMe! Tag Cloud -->
 			<scot:createdBy rdf:resource="<c:out value='${user.URI}'/>"/>
 			<scot:tagSpace rdf:resource="<%= VIEW_VOCABULARY.GROUPME_BASE_URL%>"/>
 			<%for(WeightedTag wt: userTagCloud){%>
 				<scot:contains>
	 				<scot:Tag>
	 					<tags:name><%=wt.tag.getKeyword() %></tags:name>
	 					<scot:ownAFrequency><%= new Double(wt.getWeight()).intValue() %></scot:ownAFrequency>
	 				</scot:Tag>
	 			</scot:contains>
 			<%} %>
	 		</scot:TagCloud>
		 <%} %>
	 <%} %>
</rdf:RDF>